<template>
  <div>
    <!-- 头部菜单 -->
    <div id="slider" class="mui-slider">
				<div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
					<div class="mui-scroll">
						<a :class="['mui-control-item',item.id==0?'mui-active':'']" v-for="item in menuList" :key="item.id" @click="getImgList(item.id)">
							{{item.item}}
						</a>
					</div>
				</div>
			</div>
      <!-- 图片 -->
      <div class="img-list">
        <ul>
          <router-link v-for="item in imgList" :key="item.id" :to="'/home/photoInfo/'+item.id" tag="li">
            <img  v-lazy="item.img_url">  
            <div class="describe"><!--  摘要  -->
              <h3 class="title">{{ item.title }}</h3>
              <span class="content">{{ item.zhaiyao }}</span>
            </div>
          </router-link>
        </ul>
      </div>

  </div>
</template>











<script>
import mui from '../../libs/mui/js/mui.js'
import img1 from '../../img/1.jpg'
export default {
  data(){
    return {
      menuList:[],
      imgList:[]
    }
  },
  mounted(){
    mui('.mui-scroll-wrapper').scroll({
	    deceleration: 0.0005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
    });
  },
  created(){
    this.getMenuList()
    this.getImgList(0)
  },
  methods:{
    async getMenuList(){
      let data=await this.ajax.get('/api/photo/menu')
      this.menuList=data.data
    },
    async getImgList(id){
      let data=await this.ajax.get(`/api/photo/photoList/${id}`)
      this.imgList=data.data
    }
  }

}
</script>












<style lang="less" scoped>
#slider{
  touch-action: pan-x; 
}
.img-list{
  li{
    position: relative;
    margin: 5px;
    img{
      width: 100%;
      vertical-align: middle;
    }
    image[lazy=loading] {
      width: 40px;
      height: 300px;
      margin: auto;
    }
    .describe{
      max-height: 90px;
      position: absolute;
      bottom:0;
      z-index: 2;
      background-color: rgba(0,0,0,.3);
      color: #FFF;
      .title{
        font-size:14px;
      }
      .content{
        font-size:12px
      }
    }
  }
}

</style>